package cn.arikeky.controller;

import cn.arikeky.domain.User;
import cn.arikeky.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;


@Controller
@RequestMapping("/user")
public class LoginController {

    @Autowired
    private UserService userService;

    // 查询账号密码
    @RequestMapping("/login")
    @ResponseBody
    public void login(@RequestBody User user, HttpSession session){
        User user1 = userService.findUser(user);
        session.setAttribute("user", user1);
    }

}
